package org.neframework.webtest.service;

import java.util.List;
import java.util.Map;

import org.neframework.webtest.model.t_fk_setting;

import com.tmsps.neframework.jpa.base.BaseService;

public class SystemService extends BaseService {

	public List<Map<String, Object>> selectSystemList() {
		String sql = "select * from t_fk_setting t where t.status=0";

		List<Map<String, Object>> list = jc.queryForList(sql);
		return list;
	}
	
	/**
	 * 系统UI列表
	 * @return
	 */
	public List<Map<String, Object>> selectSystemUiList() {
		String sql = "select * from t_fk_ui t where t.status=0";

		List<Map<String, Object>> list = jc.queryForList(sql);
		return list;
	}

		
	public static void main(String[] args) {
	}

	public String get(String key) {
		// TODO 根据 key 查出系统设置的 value
		String sql = "select * from t_fk_setting t where t.status=0 and t.field=? ";
		t_fk_setting setting = (t_fk_setting) oc.findObj(sql, new String[] { key }, t_fk_setting.class);
		if (setting == null) {
			throw new RuntimeException("请设置[系统参数设置]中的项------>" + key);
		}
		return setting.getVal();
	}

}
